<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AngularJS service</title>
    <script src="../bower_components/angular/angular.min.js"></script>
</head>
<body ng-app="myapp">
    <div ng-controller="MyController">
        Movie title: <input type="text" ng-model="title" />
    </div>

    <script type="text/javascript">
        var app = angular.module('myapp', []);
        app.provider('movie', function() {
            var version;
            return {
                setVersion: function(value) {
                    version = value;
                },
                $get: function() {
                    return {
                        title: 'The Matrix' + ' ' + version
                    }
                }
            }
        });
        app.config(function(movieProvider) {
            movieProvider.setVersion('Reloaded');
        });
        app.controller('MyController', function($scope, movie) {
            //expect(movie.title).toEqual('The Matrix Reloaded');
            $scope.title = movie.title;
            console.log(movie.title);
        });
    </script>
</body>
</html>